import xtRequest from "../index"
import { IRootState , ILoginResult,IUserMenu} from "@/types/userType"

enum LoginAPI {
  AccountLogin = "/login",
  LoginUserInfo = "/users/",
  UserMenuList = "/role/"
}

// 用户登录操作
export function accountLoginRequest(account: IRootState) {
  return xtRequest.post<ILoginResult>({
    url: LoginAPI.AccountLogin,
    data: account,
  })
}

// 请求用户信息
export function requestLoginInfo(id:string) {
  return xtRequest.get({
    url: LoginAPI.LoginUserInfo + id
  })
}

// 请求用户菜单列表
export function requestUserMenu(id:string) {
  return xtRequest.get<IUserMenu[]>({
    url: LoginAPI.UserMenuList + id + "/menu"
  })
}
